﻿@using Portal.Frontend.UI.Helpers
@model RSHB.Frontend.UI.ViewModels.UserBrowseViewModel

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="action_panel">
    <ul>
        <li>@Html.ImageActionAddLink("Создать", string.Empty, "Create", "Individual")</li>
    </ul>
</div>

<table class="list"cellspacing="0" cellpadding="0" border="0">
<thead>
    <tr>
        <td>ФИО</td>
        <td>Роли</td>
    </tr>
</thead>
<tfoot>
    <tr>
        <td colspan="5">Всего: @Model.Individuals.Count</td>
    </tr>
</tfoot>
<tbody>
@foreach (var user in Model.Individuals)
{
    <tr>
        <td>@Html.ActionLink(string.Format("{0} {1} {2}", @user.VCards.SingleOrDefault().vcardNameLast, @user.VCards.SingleOrDefault().vcardNameFirst, @user.VCards.SingleOrDefault().vcardNameMiddle), "Edit", new { id = user.UserID })</td>
        <td>
            Заемщик: 
            @foreach (var asBorrower in user.LoanAgreements)
            {
                <span>@Html.ActionLink(string.Format("{0} ({1})", asBorrower.LoanAgreementTitle, asBorrower.LoanAgreementNum), "Edit", "LoanAgreement", new { id = asBorrower.LoanAgreementID }, null)</span>
            }
            <br />
            Созаемщик: 
            @foreach (var asCoBorrower in user.LoanAgreements1)
            {
                <span>@Html.ActionLink(string.Format("{0} ({1})", asCoBorrower.LoanAgreementTitle, asCoBorrower.LoanAgreementNum), "Edit", "LoanAgreement", new { id = asCoBorrower.LoanAgreementID }, null)</span>
            }
        </td>
    </tr>
}
</tbody>
</table>


